package bean;

import java.beans.PropertyVetoException;
import java.beans.VetoableChangeListener;
import java.beans.VetoableChangeSupport;

/**
 * Description:
 * Created by E460 on 2017/9/25.
 */
public class StudentWithListenerOfVetoAndChange extends  StudentWithListenerOfChanage {
    private String vetoValue="pass";
    private VetoableChangeSupport vetoableChangeSupport = new VetoableChangeSupport(this);

    public void addVetoableChangeListener(VetoableChangeListener listener) {
        vetoableChangeSupport.addVetoableChangeListener(listener);
    }

    public void removeVetoableChangeListener(VetoableChangeListener listener) {
        vetoableChangeSupport.removeVetoableChangeListener(listener);
    }

    public String getVetoValue() {
        return vetoValue;
    }

    public void setVetoValue(String vetoValue) throws PropertyVetoException {
        vetoableChangeSupport.fireVetoableChange("vetoValue",this.vetoValue,vetoValue);
        this.vetoValue = vetoValue;
    }

    @Override
    public String toString() {
        return "StudentWithListenerOfVetoAndChange{" +
                "vetoValue='" + vetoValue + '\'' +
                '}';
    }
}
